package com.vinfai.thread.atomic;

import java.util.concurrent.atomic.AtomicIntegerArray;

import org.junit.Test;
import static org.junit.Assert.*;

public class AtomicIntegerArrayTest {
	
	@Test
	public void testAll(){
		final AtomicIntegerArray arr = new AtomicIntegerArray(10);
		assertEquals(arr.addAndGet(0, 2), 2);
		assertEquals(arr.getAndAdd(1, 2), 0);
		assertEquals(arr.get(1),2);
		assertEquals(arr.length(),10);
		assertEquals(arr.compareAndSet(0, 1, 2),false);
		assertEquals(arr.getAndIncrement(3), 0);
		assertEquals(arr.incrementAndGet(4), 1);
	}
}
